home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Burning & Media
/
GB-PVR 1.2.13
/
GBPVR10213.msi
/
Cabs.w1.cab
/
Details.aspx.cs589
< prev
next >
Wrap
Text File
|
2008-03-12
|
36KB
|
881 lines
//===========================================================================
// This file was modified as part of an ASP.NET 2.0 Web project conversion.
// The class name was changed and the class modified to inherit from the abstract base class
// in file 'App_Code\Migrated\Stub_Details_aspx_cs.cs'.
// During runtime, this allows other classes in your web application to bind and access
// the code-behind page using the abstract base class.
// The associated content page 'Details.aspx' was also modified to refer to the new class name.
// For more information on this code pattern, please refer to http://go.microsoft.com/fwlink/?LinkId=46995
//===========================================================================
using System;
using System.Collections;
using System.Data.Common;
using System.IO;
using System.Threading;
using System.Web;
using System.Xml;
using GBPVR.Public;
using GBPVRSchedule;
using gbweb.classes;
namespace gbweb
{
/// <summary>
/// Summary description for Details.
/// </summary>
public partial class Migrated_Details : Details
{
private Settings guideParams;
protected string programUniqueIdentifier;
protected void Page_Load(object sender, EventArgs e)
{
getTheme();
guideParams = Global.Settings;
if (!IsPostBack)
{
Schedule scheduleHelper = Global.Schedule;
Programme programme = null;
currentlyRecording.Visible = false;
updateEndTime.Checked = false;
newEndTime.Visible = false;
// if this show was already scheduled, view=cancel would have been passed in
ScheduledRecording scheduledRecording = null;
if (Request.Params["rid"] != null)
{
recordingOptionsPanel.Visible = false;
spanRecordCancel.InnerText = "Recording Not Found!";
lnkRecordCancel.CommandName = "cancel";
//Since we are looking at a recorded show the user should be able to see the Stream Now button
streamNow.Visible = true;
scheduledRecording = scheduleHelper.GetScheduledRecordingByOID(Convert.ToInt32(Request.Params["rid"]));
if (scheduledRecording != null)
{
prePadding.Text = scheduledRecording.getPrePadMinutes().ToString();
postPadding.Text = scheduledRecording.getPostPadMinutes().ToString();
watchLink.HRef = Download.GetDownloadUrl(false, false, Convert.ToInt32(Request.Params["rid"]));
watchLink.Visible = false;
// reload recording list
string recorded_quality;
switch (scheduledRecording.getQualitySetting())
{
case (int)Schedule.Quality.Low:
recorded_quality = "Low";
newQuality.SelectedValue = "Low";
break;
case (int)Schedule.Quality.Medium:
recorded_quality = "Medium";
newQuality.SelectedValue = "Medium";
break;
case (int)Schedule.Quality.High:
recorded_quality = "High";
newQuality.SelectedValue = "High";
break;
case (int)Schedule.Quality.Custom1:
recorded_quality = "Custom 1";
newQuality.SelectedValue = "Custom1";
break;
case (int)Schedule.Quality.Custom2:
recorded_quality = "Custom 2";
newQuality.SelectedValue = "Custom2";
break;
case (int)Schedule.Quality.LiveTV:
recorded_quality = "LiveTV";
newQuality.SelectedValue = "LiveTV";
break;
default:
recorded_quality = string.Empty;
break;
}
recordingQuality.Text = recorded_quality;
switch (scheduledRecording.getRecordingStatus())
{
case ScheduledRecording.STATUS_PENDING:
lnkRecordCancel.CssClass = "btn-normal-large";
spanRecordCancel.InnerText = "Cancel Recording";
padStart.Text = Convert.ToString(scheduledRecording.getPrePadMinutes());
padEnd.Text = Convert.ToString(scheduledRecording.getPostPadMinutes());
currentlyRecording.Visible = true;
break;
case ScheduledRecording.STATUS_IN_PROGRESS:
lnkRecordCancel.CssClass = "btn-normal-large-red";
spanRecordCancel.InnerText = "Cancel Recording";
padStart.Text = Convert.ToString(scheduledRecording.getPrePadMinutes());
padEnd.Text = Convert.ToString(scheduledRecording.getPostPadMinutes());
currentlyRecording.Visible = true;
watchLink.Visible = true;
break;
case ScheduledRecording.STATUS_COMPLETED:
lnkRecordCancel.CssClass = "btn-normal-large-red";
spanRecordCancel.InnerText = "Delete Recording";
watchLink.Visible = true;
break;
case ScheduledRecording.STATUS_COMPLETED_WITH_ERROR:
lnkRecordCancel.CssClass = "btn-normal-large-red";
spanRecordCancel.InnerText = "Delete Recording";
break;
case ScheduledRecording.STATUS_CONFLICT:
lnkRecordCancel.CssClass = "btn-normal-large";
spanRecordCancel.InnerText = "Cancel Recording";
break;
case ScheduledRecording.STATUS_PLACE_HOLDER:
lnkRecordCancel.CssClass = "btn-normal-large";
spanRecordCancel.InnerText = "Cancel Recording";
break;
case ScheduledRecording.STATUS_DELETED:
lnkRecordCancel.CssClass = "btn-normal-large";
spanRecordCancel.InnerText = "Record This Episode";
break;
default:
lnkRecordCancel.CssClass = "btn-normal-large";
spanRecordCancel.InnerText = "Unknown Status!";
break;
}
}
if (Request.Params["id"] != null)
{
programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
}
else
{
programme = null;
}
}
else
{
recordingDetailsPanel.Visible = false;
spanRecordCancel.InnerText = "Record This Episode";
lnkRecordCancel.CommandName = "record";
programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
XmlNode pre = Global.Config.SelectSingleNode("/settings/PreShowPadding");
XmlNode post = Global.Config.SelectSingleNode("/settings/PostShowPadding");
prePadding.Text = pre.InnerText;
postPadding.Text = post.InnerText;
}
if (programme != null)
{
//check to see if the user has VLC installed to do streaming
bool strmAllowed = File.Exists(Path.Combine(guideParams.strmVLCLoc, "vlc.exe"));
if (strmAllowed)
{
//If the programme is in the current time period (it is airing now) or it was recorded previously then the user can Stream Now
if ((programme.getStartTime() <= DateTime.Now &&
programme.getEndTime() > DateTime.Now.AddMinutes(1)) ||
(Request.Params["rid"] != null && programme.getStartTime() <= DateTime.Now))
{
streamNow.Visible = true;
}
else
{
streamNow.Visible = false;
}
}
else
{
streamNow.Visible = false;
}
// show programme details
showTitle.Text = programme.getTitle();
programUniqueIdentifier = programme.getUniqueProgrammeIdentifier();
showSubTitle.Text = programme.getSubTitle();
string description = DetailDisplay.getDetailDisplay(programme);
showDescription.Text = description;
subTitlePanel.Visible = showSubTitle.Text.Length > 0;
descriptionPanel.Visible = showDescription.Text.Length > 0;
divUniqueID.Visible = programUniqueIdentifier.Length > 0;
showStartDate.Text = programme.getStartTime().ToLongDateString();
//If the programme being viewed is already set to record or is recorded then we want to pull the end time
//from the recording rather than how the program was listed on the EPG.
if (scheduledRecording != null)
{
showTimes.Text = programme.getStartTime().ToShortTimeString() + " - " +
scheduledRecording.getEndTime().ToShortTimeString();
}
else
{
showTimes.Text = programme.getStartTime().ToShortTimeString() + " - " +
programme.getEndTime().ToShortTimeString();
}
Channel channel = scheduleHelper.GetChannelByOID(programme.getChannelOID());
string channelName = channel.getName();
if (channelName.StartsWith(channel.getChannelNumber().ToString()))
// cosmetic stuff for my american friends
{
channelName = channelName.Substring(channel.getChannelNumber().ToString().Length);
}
showChannel.Text = "<span class=\"channelnumber\"><b>" + channel.getChannelNumber() +
"</b></span> (<span class=\"channelname\"><nobr>" + channelName +
"</nobr></span>)";
//Set the default recording Quality
quality.SelectedValue = guideParams.recordingQuality;
TimeSpan span = programme.getStartTime() - DateTime.Now;
if (span.Minutes >= 0)
{
reminderButton.Text = "<span>Set Reminder</span>";
ArrayList reminders = scheduleHelper.GetReminderList();
foreach (Programme pgm in reminders)
{
if (pgm.getOID() == programme.getOID())
{
reminderButton.Text = "<span>Kill Reminder</span>";
}
}
}
else
{
reminderButton.Visible = false;
}
}
else
{
streamNow.Visible = false;
reminderButton.Visible = false;
showStartDate.Text = "Season Recording";
subTitlePanel.Visible = false;
descriptionPanel.Visible = false;
divUniqueID.Visible = false;
recordingOptionsPanel.Visible = true;
radioDay.Visible = false;
radioTime.Visible = false;
recordingsToKeep.Visible = false;
if (scheduledRecording != null)
{
checkedDays.Visible = true;
showTimes.Text = scheduledRecording.getStartTime().ToShortTimeString() + " - " +
scheduledRecording.getEndTime().ToShortTimeString();
showTitle.Text = scheduledRecording.getFileName();
checkedDays.Enabled = false;
int day_mask = scheduleHelper.getSeasonDayMask(scheduledRecording);
if (day_mask != -1)
{
if ((day_mask & ReoccuringRecordingExtras.DAY_SUNDAY) > 0)
{
checkedDays.Items[6].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_SATURDAY) > 0)
{
checkedDays.Items[5].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_FRIDAY) > 0)
{
checkedDays.Items[4].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_THURSDAY) > 0)
{
checkedDays.Items[3].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_WEDNESDAY) > 0)
{
checkedDays.Items[2].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_TUESDAY) > 0)
{
checkedDays.Items[1].Selected = true;
}
if ((day_mask & ReoccuringRecordingExtras.DAY_MONDAY) > 0)
{
checkedDays.Items[0].Selected = true;
}
}
}
else
{
checkedDays.Visible = false;
showTimes.Text = string.Empty;
showTitle.Text = string.Empty;
}
spanRecordCancel.InnerText = "Update Season Recording";
lnkRecordCancel.CommandName = "update";
Channel channel = scheduleHelper.GetChannelByOID(scheduledRecording.getChannelOID());
string channelName = channel.getName();
if (channelName.StartsWith(channel.getChannelNumber().ToString()))
// cosmetic stuff for my american friends
{
channelName = channelName.Substring(channel.getChannelNumber().ToString().Length);
}
showChannel.Text = "<span class=\"channelnumber\"><b>" + channel.getChannelNumber() +
"</b></span> (<span class=\"channelname\"><nobr>" + channelName +
"</nobr></span>)";
switch ((Schedule.Quality)scheduledRecording.getQualitySetting())
{
case Schedule.Quality.High:
quality.SelectedValue = "High";
newQuality.SelectedValue = "High";
break;
case Schedule.Quality.Medium:
quality.SelectedValue = "Medium";
newQuality.SelectedValue = "Medium";
break;
case Schedule.Quality.Low:
quality.SelectedValue = "Low";
newQuality.SelectedValue = "Low";
break;
case Schedule.Quality.Custom1:
quality.SelectedValue = "Custom1";
newQuality.SelectedValue = "Custom1";
break;
case Schedule.Quality.Custom2:
quality.SelectedValue = "Custom2";
newQuality.SelectedValue = "Custom2";
break;
}
radioTime.Items[0].Enabled = false;
if (scheduledRecording.getStartTime().Year != 0001)
{
radioTime.SelectedValue = "thisTime";
}
else
{
radioTime.SelectedValue = "anyTime";
}
prePadding.Text = scheduledRecording.getPrePadMinutes().ToString();
postPadding.Text = scheduledRecording.getPostPadMinutes().ToString();
}
//Guest Users do not get access to initiatie, delete or cancel recordings.
lnkRecordCancel.Visible = Convert.ToBoolean((string) Session["NotGuestUser"]);
if (Request.Params["rid"] != null && recordingOptionsPanel.Visible)
{
recordingOptionsPanel.Visible = Convert.ToBoolean((string) Session["NotGuestUser"]);
}
}
}
protected void lnkRecordCancel_Click(object sender, EventArgs e)
{
Schedule scheduleHelper = Global.Schedule;
Programme programme = null;
if (Request.Params["id"] != null && lnkRecordCancel.CommandName != "cancel")
{
programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
if (Convert.ToDouble(extendMinutes2.Text) != 0)
{
//Add the number of minutes that was entered to the end time of the recording to set the new end time
DateTime newEndDate =
programme.getEndTime().AddMinutes(Convert.ToDouble(extendMinutes2.Text));
//Set the new end time for the recording
programme.setEndTime(newEndDate);
}
}
bool scheduleReturn = true;
if (lnkRecordCancel.CommandName == "record")
{
Schedule.Quality quality = 0;
int prePad = Convert.ToInt32(prePadding.Text);
int postPad = Convert.ToInt32(postPadding.Text);
switch (Request.Params["quality"].ToLower())
{
case "high":
quality = Schedule.Quality.High;
break;
case "medium":
quality = Schedule.Quality.Medium;
break;
case "low":
quality = Schedule.Quality.Low;
break;
case "custom1":
quality = Schedule.Quality.Custom1;
break;
case "custom2":
quality = Schedule.Quality.Custom2;
break;
}
if (radioTime.SelectedValue == "once")
{
// schedule one-off recording
Schedule myschedule = Global.Schedule;
scheduleReturn = myschedule.ScheduleOnce(programme, quality, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
else
{
//Schedule Season Recordings
//Set the max number of recordings to keep for the show
int keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
if (keepRecordings.Text.ToString() != null)
{
try
{
keepnumRecordings = Convert.ToInt32(keepRecordings.Text);
}
catch
{
keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
}
}
else
{
keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
}
Schedule myschedule = Global.Schedule;
if (radioTime.SelectedValue == "thisTime")
{
// schedule season recording for any day and this time
if (radioDay.SelectedValue == "anyDay")
{
scheduleReturn = myschedule.ScheduleThisTime(programme, quality, Schedule.DayType.SheduleAnyDay, keepnumRecordings, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
// schedule season recording for only this day and this time
else if (radioDay.SelectedValue == "thisDay")
{
scheduleReturn = myschedule.ScheduleThisTime(programme, quality, Schedule.DayType.SheduleThisDay, keepnumRecordings, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
// schedule season recording for the selected days and this time
else
{
ArrayList dayList = new ArrayList();
// Iterate through the Items collection of the checkedDays
// control and create the correct number for the season recording.
for (int i=0; i<checkedDays.Items.Count; i++)
{
if (checkedDays.Items[i].Selected)
{
switch (checkedDays.Items[i].Text)
{
case "Monday":
dayList.Add(Schedule.Day.Monday);
break;
case "Tuesday":
dayList.Add(Schedule.Day.Tuesday);
break;
case "Wednesday":
dayList.Add(Schedule.Day.Wednesday);
break;
case "Thursday":
dayList.Add(Schedule.Day.Thursday);
break;
case "Friday":
dayList.Add(Schedule.Day.Friday);
break;
case "Saturday":
dayList.Add(Schedule.Day.Saturday);
break;
case "Sunday":
dayList.Add(Schedule.Day.Sunday);
break;
}
}
}
scheduleReturn = myschedule.ScheduleThisTime(programme, quality, Schedule.DayType.SheduleSpecificDays, keepnumRecordings, dayList, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
}
else
{
// schedule season recording for any day any time
if (radioDay.SelectedValue == "anyDay")
{
scheduleReturn = myschedule.ScheduleAnyTime(programme, quality, Schedule.DayType.SheduleAnyDay, keepnumRecordings, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
// schedule season recording for only this day and this time
else if (radioDay.SelectedValue == "thisDay")
{
scheduleReturn = myschedule.ScheduleAnyTime(programme, quality, Schedule.DayType.SheduleThisDay, keepnumRecordings, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
// schedule season recording for the selected days and this time
else
{
ArrayList dayList = new ArrayList();
// Iterate through the Items collection of the checkedDays
// control and create the correct number for the season recording.
for (int i=0; i<checkedDays.Items.Count; i++)
{
if (checkedDays.Items[i].Selected)
{
switch (checkedDays.Items[i].Text)
{
case "Monday":
dayList.Add(Schedule.Day.Monday);
break;
case "Tuesday":
dayList.Add(Schedule.Day.Tuesday);
break;
case "Wednesday":
dayList.Add(Schedule.Day.Wednesday);
break;
case "Thursday":
dayList.Add(Schedule.Day.Thursday);
break;
case "Friday":
dayList.Add(Schedule.Day.Friday);
break;
case "Saturday":
dayList.Add(Schedule.Day.Saturday);
break;
case "Sunday":
dayList.Add(Schedule.Day.Sunday);
break;
}
}
}
scheduleReturn = myschedule.ScheduleAnyTime(programme, quality, Schedule.DayType.SheduleSpecificDays, keepnumRecordings, dayList, Schedule.RecType.Season, prePad, postPad);
if (scheduleReturn)
{
// build up a list of the recording we already know about
IDictionary knownRecordings = scheduleHelper.LoadKnownRecordings();
if (!knownRecordings.Contains(programme.getOID()))
{
scheduleReturn = false;
}
}
}
}
}
if (scheduleReturn)
{
// close popup details window
Page.RegisterStartupScript("startupScript", "<script language=JavaScript>reloadAndClose();</script>");
}
else
{
RecordMessage.Text = "Recording Failed!";
RecordMessage.Visible = true;
}
}
else if (lnkRecordCancel.CommandName == "cancel")
{
ScheduledRecording scheduledRecording = scheduleHelper.GetScheduledRecordingByOID(Convert.ToInt32(Request.Params["rid"]));
if (scheduledRecording != null)
{
scheduleHelper.CancelScheduledRecording(scheduledRecording);
}
Page.RegisterStartupScript("startupScript", "<script language=JavaScript>reloadAndClose();</script>");
}
else if (lnkRecordCancel.CommandName == "update")
{
//Create a scheduled recording object of the programme being viewed so we have something to modify
ScheduledRecording scheduledRecording = scheduleHelper.GetScheduledRecordingByOID(Convert.ToInt32(Request.Params["rid"]));
//Set the pre and post padding minutes
scheduledRecording.setPrePadMinutes(Convert.ToInt32(prePadding.Text));
scheduledRecording.setPostPadMinutes(Convert.ToInt32(postPadding.Text));
//Set the quality
Schedule.Quality quality = 0;
switch (Request.Params["quality"].ToLower())
{
case "high":
quality = Schedule.Quality.High;
break;
case "medium":
quality = Schedule.Quality.Medium;
break;
case "low":
quality = Schedule.Quality.Low;
break;
case "custom1":
quality = Schedule.Quality.Custom1;
break;
case "custom2":
quality = Schedule.Quality.Custom2;
break;
}
scheduledRecording.setQualitySetting((int) quality);
//Use the API to update the recording on the database
scheduleHelper.UpdateScheduledRecording(scheduledRecording);
//Close the window
Page.RegisterStartupScript("startupScript", "<script language=JavaScript>windowClose();</script>");
}
}
private void getTheme()
{
string theme = Convert.ToString(Session["theme"]);
if (theme != null && theme != "")
{
return;
}
else
{
HttpCookie cookie = Request.Cookies["theme"];
if (cookie != null && cookie.Value.Length > 0)
{
theme = cookie.Value;
}
else
{
theme = "Default";
}
Session["theme"] = "themes/" + theme;
return;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void LinkButton1_Click(object sender, EventArgs e)
{
Schedule scheduleHelper = Global.Schedule;
ScheduledRecording scheduledRecording_check = scheduleHelper.GetScheduledRecordingByOID(Convert.ToInt32(Request.Params["rid"]));
if (scheduledRecording_check == null)
{
Programme programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
if (Convert.ToDouble(extendMinutes2.Text) != 0)
{
//Add the number of minutes that was entered to the end time of the recording to set the new end time
DateTime newEndDate =
programme.getEndTime().AddMinutes(Convert.ToDouble(extendMinutes2.Text));
//Set the new end time for the recording
programme.setEndTime(newEndDate);
}
bool scheduleReturn = true;
Schedule.Quality quality = 0;
int prePad = Convert.ToInt32(prePadding.Text);
int postPad = Convert.ToInt32(postPadding.Text);
switch (Request.Params["quality"].ToLower())
{
case "high":
quality = Schedule.Quality.High;
break;
case "medium":
quality = Schedule.Quality.Medium;
break;
case "low":
quality = Schedule.Quality.Low;
break;
case "custom1":
quality = Schedule.Quality.Custom1;
break;
case "custom2":
quality = Schedule.Quality.Custom2;
break;
}
Schedule myschedule = Global.Schedule;
scheduleReturn = myschedule.ScheduleOnce(programme, quality, prePad, postPad);
if (scheduleReturn)
{
Thread.Sleep(5000);
IList myScheduledRecordings = scheduleHelper.LoadRecordingSchedule();
foreach (ScheduledRecording scheduledRecording in myScheduledRecordings)
{
if (scheduledRecording.getProgrammeOID() == programme.getOID())
{
Response.Redirect("public/Player.aspx?rid=" + scheduledRecording.getOID() + "&type=sn");
break;
}
}
RecordMessage.Text = "Stream Now Failed!";
RecordMessage.Visible = true;
}
else
{
RecordMessage.Text = "Stream Now Failed!";
RecordMessage.Visible = true;
}
}
else
{
Response.Redirect("public/Player.aspx?rid=" + scheduledRecording_check.getOID() + "&type=mr");
}
}
protected void updateEndTime_CheckedChanged(object sender, EventArgs e)
{
//Logic that shows and hides the area for entering number of minutes to extend a recording
if (newEndTime.Visible == false)
{
newEndTime.Visible = true;
}
else
{
newEndTime.Visible = false;
}
}
protected void reminderButton_Click(object sender, EventArgs e)
{
Schedule scheduleHelper = Global.Schedule;
Programme programme = null;
programme = scheduleHelper.GetProgrammeByOID(int.Parse(Request.Params["id"]));
if (reminderButton.Text == "<span>Set Reminder</span>")
{
scheduleHelper.CreateReminder(programme);
reminderButton.Text = "<span>Kill Reminder</span>";
}
else
{
scheduleHelper.RemoveReminder(programme);
reminderButton.Text = "<span>Set Reminder</span>";
}
}
protected void endTimeUpdate_Click(object sender, EventArgs e)
{
//Create a new schedulehelper
Schedule scheduleHelper = Global.Schedule;
//Create a scheduled recording object of the programme being viewed so we have something to modify
ScheduledRecording scheduledRecording = scheduleHelper.GetScheduledRecordingByOID(Convert.ToInt32(Request.Params["rid"]));
//Set the pre and post padding minutes
scheduledRecording.setPrePadMinutes(Convert.ToInt32(padStart.Text));
scheduledRecording.setPostPadMinutes(Convert.ToInt32(padEnd.Text));
//Add the number of minutes that was entered to the end time of the recording to set the new end time
DateTime newEndDate = scheduledRecording.getEndTime().AddMinutes(Convert.ToDouble(extendMinutes.Text));
//Set the new end time for the recording
scheduledRecording.setEndTime(newEndDate);
//Set the quality to the new setting
Schedule.Quality Newquality = 0;
switch (newQuality.SelectedValue.ToLower())
{
case "high":
Newquality = Schedule.Quality.High;
break;
case "medium":
Newquality = Schedule.Quality.Medium;
break;
case "low":
Newquality = Schedule.Quality.Low;
break;
case "custom1":
Newquality = Schedule.Quality.Custom1;
break;
case "custom2":
Newquality = Schedule.Quality.Custom2;
break;
}
scheduledRecording.setQualitySetting((int)Newquality);
//Use the API to update the recording on the database
scheduleHelper.UpdateScheduledRecording(scheduledRecording);
//Close the window
ClientScript.RegisterStartupScript(typeof(String), "startupScript", "<script language=JavaScript>windowClose();</script>", false);
}
}
}